#include<iostream>
#include<string>
using namespace std;
void Fill_array(double arr[], int n);

int main(){
    double arr[10] = {0};
    Fill_array(arr, 10);
    // Print arr
    for (int i=0; i < 10; i++){
        cout << "arr[" << i << "] = " << arr[i] << endl;
    }
}

void Fill_array(double arr[], int n){
    cout << "Enter numbers" << endl;
    string s;
    int count = 0, n_nums = 0;
    
    while (count < n){
        cin >> s;
        // 判断s是否有非数字
        try {
            arr[count] = stod(s);
            n_nums++;
            count++;
        }
        catch(...){
            break;
        }
    }
    cout <<"数组输入" << n_nums << "个数字." << endl;
}